

package services;

import dto.TrainingPlanDTO;
import persistences.TrainingPlanDAO;
import persistences.UserDAO;
@SuppressWarnings("unused")
public class TrainingPlan {
	private String planId;
	private String planName;
	private String planYear;
	private String startDate;
	private String endDate;
	private String unitName;
	private String trainingPurpose;
	private String trainingContent;
	private String classHours;
	private String teacherName;
	TrainingPlanDTO trainingPlanDTO = new TrainingPlanDTO();
	
	public TrainingPlan(String planId, String planName, String planYear, String startDate, String endDate,
			String unitName, String trainingPurpose, String trainingContent, String classHours, String teacherName) {
		super();
		this.planId = planId;
		this.planName = planName;
		this.planYear = planYear;
		this.startDate = startDate;
		this.endDate = endDate;
		this.unitName = unitName;
		this.trainingPurpose = trainingPurpose;
		this.trainingContent = trainingContent;
		this.classHours = classHours;
		this.teacherName = teacherName;
	}
	
	public void trainingPlanInit(){
		trainingPlanDTO.setPlanId(planId);
		trainingPlanDTO.setPlanName(planName);
		trainingPlanDTO.setPlanYear(planYear);
		trainingPlanDTO.setStartDate(startDate);
		trainingPlanDTO.setEndDate(endDate);
		trainingPlanDTO.setUnitName(unitName);
		trainingPlanDTO.setTrainingPurpose(trainingPurpose);
		trainingPlanDTO.setTrainingContent(trainingContent);
		trainingPlanDTO.setClassHours(classHours);
		trainingPlanDTO.setTeacherName(teacherName);
	}
	
	
	public boolean addTrainingPlan(){
		boolean result = false;
		trainingPlanInit();
		result = new TrainingPlanDAO().addTrainingPlan(trainingPlanDTO);
				
		return result;
	}

	public boolean updateTrainingPlan(){
		boolean result = false;
		trainingPlanInit();
		result = new TrainingPlanDAO().updateTrainingPlan(trainingPlanDTO);
				
		return result;
	}

	public boolean deleteTrainingPlan(){
		boolean result = false;
		
		result = new TrainingPlanDAO().deleteTrainingPlan(this.planId);
				
		return result;
	}

	public boolean searchTrainingPlan(){
		boolean result = false;
		
		result = new TrainingPlanDAO().searchTrainingPlan(this.planId);
				
		return result;
	}

	
	
}
